<template>
	<view class="container">
		<image class="bg"
			src="https://img2.baidu.com/it/u=1737067577,8701429&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889"
			mode="aspectFill"></image>
		<view class="main">
			<view class="btns">
				<view @click="toUrl('/pages/breed1/index')">品种排名</view>
				<view @click="toUrl('/pages/detail/index')">搜索框</view>
				<view @click="toUrl('/pages/breed2/index')">拍照识别</view>
			</view>
			<view class="jlgg">
<ad unit-id="adunit-d4dda5ea5489ddce"></ad>
			</view>
		</view>
	</view>
</template>

<script>
	let rewardedVideoAd = null
	export default {
		data() {
			return {

			};
		},
		onShow() {

		},
		onLoad() {
			if (wx.createRewardedVideoAd) {
				rewardedVideoAd = wx.createRewardedVideoAd({
					adUnitId: 'adunit-d4dda5ea5489ddce'
				})
				rewardedVideoAd.onLoad(() => {
					rewardedVideoAd.show()
				})
				rewardedVideoAd.onError((err) => {
					console.log('onError event emit', err)
				})
				rewardedVideoAd.onClose((res) => {
					console.log('onClose event emit', res)
				})
			}
		},
		methods: {
			toUrl(url) {
				uni.navigateTo({
					url
				})
			},
			init() {
				this.$req.get("/api/barrage").then((res) => {
					if (res.code == 0) {

					}
				});
			}
		},
	};
</script>

<style lang="scss" scoped>
	.container {
		background-color: #ffffff;
		height: 100%;
		padding-top: var(--status-bar-height);
		display: flex;
		flex-direction: column;
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;

		.bg {
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
		}

		.main {
			position: relative;
			max-height: 100%;
			overflow: auto;

			.btns {
				>view {
					width: 400rpx;
					background: #FFF;
					border: 2rpx solid #000;
					height: 80rpx;
					line-height: 80rpx;
					margin: 0 auto;
					margin-bottom: 50rpx;
					text-align: center;
				}
			}

			.jlgg {
				width: 500rpx;
				height: 600rpx;
				background: #FFF;
				border: 2rpx solid #000;
				margin: 0 auto;
			}
		}
	}
</style>